n=1000; m=100; k=30; tube=[|253,74,85| 441,68,73| 686,16,26| 774,8,68| 741,81,91| 912,8,44| 841,76,84| 181,73,80| 133,7,64| 350,77,100| 506,15,64| 770,60,76| 518,34,92| 782,77,79| 655,82,94| 828,81,93| 165,52,88| 877,9,58| 762,77,85| 852,26,43| 975,13,35| 314,93,96| 121,64,77| 859,44,49| 256,1,36| 47,83,88| 80,20,41| 855,89,94| 898,92,97| 883,33,53|]; X=[8,3,4,6,4,8,7,2,1,9,3,1,8,8,7,8,1,1,5,8,4,6,9,3,8,6,5,9,1,2,1,2,8,3,5,9,4,4,9,9,7,6,9,9,4,6,6,9,4,3,8,2,5,2,8,9,3,2,9,2,5,2,8,1,1,6,3,7,9,1,6,7,4,1,4,3,6,6,2,4,9,7,6,6,9,9,2,1,2,5,2,9,6,8,2,6,1,7,4,8,4,5,1,8,4,2,8,7,6,1,6,1,4,9,7,7,2,5,4,8,4,8,1,7,7,9,8,4,5,6,7,9,9,5,2,6,2,8,8,5,5,5,2,2,8,5,5,8,3,4,5,7,3,2,5,1,8,7,8,2,1,8,7,6,6,2,6,2,2,4,5,2,4,8,5,5,2,6,6,6,5,9,1,6,9,6,8,5,1,1,8,6,5,5,8,2,1,2,7,3,3,8,8,8,2,2,4,4,2,7,5,2,5,5,6,6,2,6,3,6,1,9,1,9,1,8,3,6,7,7,6,8,3,2,3,7,4,4,1,2,4,1,6,3,3,3,8,1,9,5,8,3,7,1,2,3,9,1,3,5,7,2,5,1,3,3,4,7,7,5,7,3,3,8,3,9,7,8,8,3,2,6,6,3,8,8,9,9,1,4,5,7,8,6,2,3,9,6,9,6,4,3,2,8,3,2,9,5,9,3,5,2,2,8,5,8,6,7,6,9,5,1,6,2,2,6,7,9,2,7,7,1,9,9,9,8,5,8,2,4,9,6,4,9,1,6,6,6,1,6,9,2,1,1,5,3,1,5,2,2,6,5,9,5,4,5,2,9,4,3,1,7,2,9,2,1,4,5,2,9,5,3,2,6,9,7,2,6,4,2,2,7,5,7,8,8,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2,2,8,2,7,4,9,1,6,3,6,4,7,9,9,6,8,5,7,3,5,9,4,9,2,6,2,4,4,3,1,9,1,2,9,6,9,6,3,8,6,4,9,2,5,2,7,2,2,2,7,1,8,5,1,1,5,8,9,1,8,8,7,9,3,6,4,3,2,8,6,3,2,7,6,5,6,7,1,8,3,8,7,3,4,3,6,7,3,7,9,8]; Y=[80,44,43,87,10,63,78,77,4,44,5,47,33,29,3,95,1,59,69,90,24,17,97,91,48,8,88,82,35,79,25,19,11,66,17,51,5,38,61,98,59,54,60,63,45,29,14,92,21,96,11,73,13,13,37,75,15,39,62,64,42,72,37,75,21,90,17,43,71,97,64,98,98,48,37,63,2,31,96,91,73,45,40,14,40,14,78,77,47,30,34,59,23,69,93,35,37,51,64,84,70,6,5,20,4,30,38,68,76,77,94,31,88,7,43,54,81,54,39,33,18,75,49,14,77,91,1,2,3,37,91,51,47,57,75,24,50,46,39,23,47,82,35,34,86,77,58,49,30,85,91,94,5,35,96,52,66,88,15,33,87,75,33,43,26,62,35,51,92,76,38,28,62,2,34,75,39,62,72,29,32,10,44,2,43,23,5,83,64,39,14,18,63,19,80,31,35,74,96,15,51,18,83,18,81,43,68,45,34,62,7,22,28,20,68,61,65,72,74,95,42,48,94,37,51,39,88,98,55,38,46,41,74,59,98,2,88,47,37,8,81,41,5,83,52,78,19,10,30,38,19,65,85,86,91,6,37,40,82,96,43,30,91,49,4,44,22,28,16,25,5,77,75,76,37,88,44,36,53,53,66,77,3,92,14,23,46,55,14,73,1,27,75,79,42,84,27,95,62,43,4,91,63,65,74,23,97,17,8,1,23,58,43,74,39,78,80,89,14,15,90,58,84,59,65,42,41,33,50,85,22,29,34,39,69,31,90,46,61,66,63,13,5,84,50,41,31,68,84,8,58,11,25,21,58,11,90,20,65,45,70,81,55,63,53,91,7,57,54,15,59,26,45,38,44,23,66,12,52,59,41,15,47,75,44,7,13,46,75,68,66,32,92,51,15,48,53,97,28,95,61,71,34,29,1,27,81,93,96,16,48,62,20,99,30,18,93,60,3,33,79,62,11,33,96,15,8,45,36,74,34,54,77,49,97,76,36,36,92,50,15,32,39,47,17,35,11,74,99,63,2,71,76,78,74,56,89,7,62,99,71,26,21,67,18,14,65,51,89,9,54,48,48,69,5,84,98,55,3,34,47,34,27,51,9,73,20,2,70,73,34,48,63,48,22,81,26,76,97,64,85,64,54,66,35,96,91,98,44,16,25,30,9,98,31,10,95,15,36,72,17,36,11,60,76,16,69,47,46,81,2,88,59,42,80,62,80,3,26,42,33,99,95,76,87,15,41,82,2,91,36,74,47,4,34,72,98,65,16,34,92,90,46,31,92,25,73,42,72,89,89,67,33,79,68,50,56,89,7,45,39,25,65,29,13,38,78,86,34,57,74,56,43,31,62,45,41,9,35,39,54,44,79,40,93,9,2,96,10,88,97,69,98,44,13,73,56,93,45,44,28,6,15,66,26,92,83,59,38,9,80,15,96,67,40,76,61,90,79,97,9,25,48,70,82,35,58,96,55,92,72,56,46,5,2,29,89,98,34,21,45,76,1,54,34,46,13,35,45,81,39,52,58,60,15,6,32,58,52,83,54,87,26,21,57,12,10,19,8,57,56,77,40,18,42,71,27,58,78,20,77,29,88,52,25,15,67,63,22,94,78,56,22,54,91,31,98,53,4,79,12,4,79,81,47,63,37,28,33,56,49,89,42,33,45,70,1,28,40,78,83,7,59,76,12,10,14,5,39,1,44,35,44,20,69,65,38,68,2,81,71,70,87,38,7,7,6,92,2,29,10,19,63,37,26,75,10,76,16,21,49,70,64,1,72,31,21,25,31,46,77,50,63,79,39,96,24,39,27,50,66,76,28,67,57,13,31,17,87,67,92,11,27,2,85,48,31,37,20,13,16,7,86,37,17,94,63,26,49,41,76,83,10,61,20,1,94,76,29,49,13,52,43,63,3,24,87,81,22,23,11,74,26,81,61,97,69,45,25,2,7,98,27,87,15,88,28,27,9,6,36,39,48,16,86,92,38,83,66,9,77,4,55,55,36,29,59,76,47,74,7,22,52,4,73,96,5,52,28,21,62,34,13,25,97,91,58,43,16,26,57,36,20,19,89,8,83,72,45,54,89,44,57,53,32,60,96,47,78,58,99,18,3,77,80,87,73,10,15,98,40,32,49,50,42,91,69,20,92,14,25,37,29,24,10,88,76,80,95,50,34,74,48,67,86,11,79,5,90,50,45,44,53,44,50,81,32,81,45,17,28,37,70,11,64,55,94,30,21,94,64,51,27,72,77,97,13,8,73,39];